#include "createdialog.h"
#include "ui_createdialog.h"

CreateDialog::CreateDialog(const QString& netID, const QString& filename, QWidget *parent) :
	QDialog(parent),
	m_ui(new Ui::CreateDialog)
{
	m_ui->setupUi(this);

	m_ui->netIDInput->setText(netID);
	m_ui->filenameInput->setText(filename);
}

CreateDialog::~CreateDialog()
{
	delete m_ui;
}

void CreateDialog::changeEvent(QEvent *e)
{
	QDialog::changeEvent(e);
	switch (e->type()) {
	case QEvent::LanguageChange:
		m_ui->retranslateUi(this);
		break;
	default:
		break;
	}
}

void CreateDialog::on_toolButton_clicked()
{
	QString * filter = new QString("Cash++ account groups (*.cash);;All files (*.*)");
	QString filename = QFileDialog::getSaveFileName(this, tr("Choose File Location"),  QString(), (*filter), filter);
	m_ui->filenameInput->setText(filename);
}

QString CreateDialog::netID()
{
	return m_ui->netIDInput->text();
}

QString CreateDialog::password()
{
	return m_ui->passwordInput->text();
}

QString CreateDialog::filename()
{
	return m_ui->filenameInput->text();
}
